<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class TB_Huiyuan extends CI_Model {
function __construct()
    {
        parent::__construct();
        $this->load->database();
    }
    	
	function Insert($hyEnt)
	{
			$this->db->insert('TB_Huiyuan', $hyEnt); 
	}
	function Update($hyEnt)
	{
			$this->db->update('TB_Huiyuan', $hyEnt,array('ID' => $hyEnt['ID']));
	}
	function Delete($ID)
	{
			$this->db->delete('TB_Huiyuan', array('ID' => $ID)); 
	}
	function GetAllHuiyuan()
	{
	//	$this->db->orderby('frequency desc, sitename asc'); 
		$query=$this->db->get('TB_Huiyuan');
			return $query->result();
		
	}
	function GetHuiyuanByID($ID)
	{
		$this->db->where('ID', $ID);
		$query=$this->db->get('TB_Huiyuan');
			return $query->result();
	}
		function GetHuiyuanByNo($huiyuan_no)
	{
		$this->db->where('hy_huiyuan_no ', $huiyuan_no);
		$query=$this->db->get('TB_Huiyuan');
			return $query->result();
	}
	function UserIsExist($UserName,$Password)
	{
		$this->db->where('UserName', $UserName);
		$this->db->where('Password', $Password);
		$query=$this->db->query("select * from TB_Huiyuan where UserName=".$UserName." and Password=".$Password);
		if ($query->num_rows() > 0)
			return true;
		else
			return false;
	}
}
?>